{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "c4f9c952-cb3b-40f1-bfb5-00d9a43a5715",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "%%capture\n",
    "## This is here as a reference only\n",
    "# Users and application developers must use the right tag for the latest from pypi\n",
    "#%pip install 'data-prep-toolkit-transforms[docling2parquet]'\n",
    "!pip install pandas\n",
    "!pip install -U ipywidgets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "76469c87-cfd0-4acd-b57f-36edc52018ff",
   "metadata": {},
   "outputs": [],
   "source": [
    "from dpk_docling2parquet import Docling2Parquet\n",
    "from data_processing.utils import GB\n",
    "from dpk_docling2parquet.transform import docling2parquet_contents_types"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "90277e74-f223-434d-b256-94079bd6c5bc",
   "metadata": {
    "scrolled": true
   },
   "outputs": [],
   "source": [
    "%%capture\n",
    "x=Docling2Parquet(input_folder= \"test-data/input\", \n",
    "               output_folder= \"output\", \n",
    "               data_files_to_use=['.pdf','.zip','.xml'],          \n",
    "               docling2parquet_contents_type=docling2parquet_contents_types.JSON).transform()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "e2bee8da-c566-4e45-bca1-354dfd04b0df",
   "metadata": {},
   "outputs": [],
   "source": [
    "import pyarrow.parquet as pq\n",
    "import pandas as pd\n",
    "table = pq.read_table('output/redp5110-ch1.parquet')\n",
    "table.to_pandas()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "cde6e37d-c437-490f-8e01-f4f51a123484",
   "metadata": {},
   "outputs": [],
   "source": [
    "#table.to_pandas()['contents'][0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b1ebd29c-4c7e-4d6a-801c-b62ff825daf3",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "ocr_fix",
   "language": "python",
   "name": "ocr_fix"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
